home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
SML40
/
!Sml
/
Sml
/
LIBINFO
< prev
next >
Wrap
Text File
|
1990-07-04
|
3KB
|
101 lines
(* SML Core language library
The following library functions are provided in the SML core language:
(* Overloaded operators *)
val makestring: 'a -> string (* defined for types int,real,bool *)
(* Integer functions *)
val min: int * int -> int
val max: int * int -> int
(* String functions *)
val size: string -> int (* returns the length of a string *)
exception Substring
val substring: (string * int * int) -> string
(* returns the substring starting from character position
of first int argument (0 is first in string) with length of
second int argument - raises Substring if string is too small *)
val explodeascii: string -> int list
(* fun explodeascii s = map ord (explode s) *)
exception ImplodeAscii
val implodeascii: int list -> string
(* returns a string corresponding to the argument list of ascii
codes. raises ImplodeAscii if a list element is <0 or >255 *)
(* List functions *)
exception Hd and Tl
val hd: 'a list -> 'a
val tl: 'a list -> 'a list
(* hd and tl return the head and tail of a list respectively,
respectively raising Hd and Tl if applied to empty lists *)
val null: 'a list -> bool
(* returns true is arg is the empty list, false otherwise *)
val length: 'a lsit -> int
(* returns the length of a list *)
val map: ('a -> 'b) -> (('a list) -> ('b list))
val fold: (('a * 'b) -> 'b) -> (('a list) -> ('b -> 'b))
val revfold: (('a * 'b) -> 'b) -> (('a list) -> ('b -> 'b))
val app: ('a -> 'b) -> (('a list) -> unit)
val revapp: ('a -> unit) -> (('a list) -> unit)
exception Nth
val nth: (('a list) * int) -> 'a
(* returns the nth (0th is first element) of a list -
raises Nth if int arg is out of range *)
val exists: (('a -> bool) * ('a list)) -> bool
(* returns true if the function f(:'a -> bool ) returns true
when applied to at least one member of the list *)
(* Reference functions *)
val inc: (int ref) -> unit
val dec: (int ref) -> unit
(* increment / decrement an int ref by 1 *)
(* Function composition *)
infix 3 o
val o: (('a -> 'b) * ('c -> 'a)) -> ('c -> 'b)
(* System and Input/Output functions *)
val stdio: unit -> (instream * outstream)
(* generates new standard input/output streams *)
val input_line: instream -> string
(* reads a line from instream and returns as a string *)
val execute: string -> (instream * outstream)
(* UNIX only - forks a process (named by the string arg)
from the shell and returns input and output streams for
that process *)
val file_exists: string -> bool
(* may use relative or full pathnames for filename in UNIX *)
val use: string -> unit
(* loads and compiles the SML programs in the named file *)
val system: string -> unit
(* passes the string to the operating system command interpreter
for execution *)
val CpuTime: unit -> int
(* returns milliseconds used by process *)
val ExportML: (string * string * (string list)) -> unit
(* create a new saved state for SML:
arg 1 - filename for saved state
arg 2 - startup message
arg 3 - list of files to be "use"d on startup *)
*)
(***************************************************************************)